ÑSince this class uses styled TextEdit, each instance of CNumberEditor has
its own font name, and font size. If you pass 0 for aFontSize, the font
will be scaled to fit the box (w/out TrueType, this might look bad).
ÑThe argument itsRect is simply a pointer to the rectangle to surround the number editor.
ÑsigDigs is the number of significant digits to display. When dealing with
the type double, specify a positive number. sigDigs is irrelevant when dealing
with the type long. Finally, when dealing with strings, pass a NEGATIVE number
for sigDigs so whenever you pass 0 for aFontSize (scaled fonts) so that the font's
descent can be accounted for.
Ñthe argument setComm is a command number that the editor's supervisor will
recieve whenever the user makes changes (this command is sent to the supervisor
when the user types RETURN or ENTER). When the supervisor gets this command,
it should get the changed data from the editor by one of three ways:
-if you're dealing with the type double:
myDouble=theEditor->GetDoubleValue();
-if you're dealing with the type long:
myLong=theEditor->GetLongValue();
-if you're dealing with strings:
theEditor->GetString(myString255);
ÑAfter you initialize theEditor, you might want to install the initial data. This is
pretty straight forward:
-if you're dealing with the type double:
theEditor->SetDoubleValue(myDouble);
-if you're dealing with the type long:
theEditor->GetLongValue(myLong);
-if you're dealing with strings:
theEditor->SetString(myString255);
When there are several of these things in a single pane, a particular one is
highlighted by passing the cursor into its box. Now type in the new data and
press RETURN or ENTER.
An example of this is in the file CTestPane, a subclass of CStarterPane. To try it
out, simply open up the Starter.╣ project and make a few changes:
Ñ#include "CTestPane.h" in the file CStarterDoc.c
Ñchange theMainPane = new(CStarterPane);
to theMainPane = new(CTestPane);
in the method BuildWindow.
ÑAdd the SANE library! (necessary).
CNumberEditor should work with the 68881 option on or off (12 byte doubles or not).
Since I hacked this together in one night and rushed it off, I'm sure there will
be bugs. This is only meant to be an act of goodwill to people on the net who have been posting about the need for an increase in the volume of public domain objects. I'm all for it. If you fix/improve this class please send me a copy of the changes at: jsorenso@thesis1.med.uth.tmc.edu